//
//  SelectModeViewController.m
//  Kjs-iOS
//
//  Created by 江伟 on 16/8/2.
//  Copyright © 2016年 jmhz. All rights reserved.
//

#import "SelectModeViewController.h"
#import "BenefitModeCell.h"

@interface SelectModeViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,weak) IBOutlet UITableView *tableView;
@end

@implementation SelectModeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setTitle:@"选择还款方式"];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - custom method
-(NSArray*)getModeName
{
    NSArray *array = [[NSArray alloc] initWithObjects:@"到期一次性还本付息",@"按月付息到期还本", nil];
    return array;
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    //    return [[self getItemTypeNameArray] count];
    return [[self getModeName] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BenefitModeCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"BenefitModeCell"];
    cell.modeNameLab.text = [self getModeName][indexPath.row];
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"选中%ld",(long)indexPath.row);
    self.selectFinish((int)indexPath.row);
    [self dismiss:YES];
    
}
@end
